home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGBLER / HERCBIOS.LZH / HCHARSET.ASM < prev    next >
Assembly Source File  |  1980-01-01  |  4KB  |  98 lines

  1.  
  2. ;**************************************************************
  3. ;*
  4. ;*     Tests Hercules BIOS, specifically the functions 9 & 10
  5. ;*     to put characters on the screen in graphics mode.
  6. ;*
  7. ;***************************************************************
  8. VIDI   equ     10H             ; video interrupt, 10H (50H for debug)
  9. cseg   segment common
  10.        assume  cs:cseg,ds:cseg
  11. START  proc
  12. ;                      ; prompt for IBM or Hercules graphics mode
  13.        mov     ah,9            ; DOS 9 = display string
  14.        mov     dx,offset mode_prmt+100H
  15.                                ; display mode prompt
  16.        int     21H             ; DOS function
  17.        mov     ah,1            ; DOS 1 = kbd input
  18.        int     21H
  19.        mov     bl,al           ; input char --> BL
  20.        mov     ax,6            ; ibm graphics mode
  21.        cmp     bl,"h"          ; input "h" for Hercules
  22.        jne     i_mode
  23.        add     ax,2            ; hercules mode
  24. i_mode:        int     VIDI
  25. ;
  26.        xor     bh,bh           ; page 0
  27.        mov     bl,7            ; normal attribute
  28.        mov     dh,1            ; cursor at <1,1> to start
  29.        mov     dl,1
  30. ;
  31.        mov     cx,24           ; do 24 rows
  32. row:   push    cx              ; save row counter
  33.        inc     dh              ; next row
  34.        mov     dl,0            ; back to first column
  35.        mov     ah,2            ; cursor move function
  36.        int     VIDI
  37. ;                      ; compute video mode
  38.        mov     bl,dh           ; row # to BL
  39.        xor     bh,bh
  40.        shr     bl,1            ; 4 rows per mode
  41.        shr     bl,1
  42.        mov     bl,mode_seq[bx+100H]    ; index into mode sequence for mode
  43. ;
  44. ;                      ; for debug, first print [row+64]
  45.        mov     al,dh
  46.        add     al,64
  47.        mov     ah,10           ; fn 10 prints w/o attributes
  48.        mov     cx,1
  49.        int     VIDI
  50. ;
  51.        xor     bh,bh           ; page 0
  52.        mov     cx,64           ; each row 64 characters
  53. achar: push    cx              ; save char counter
  54.        mov     ah,9            ; write_char function
  55.        mov     al,dh           ; character = col + (row mod 2)*64
  56.        and     al,1            ; row mod 2
  57.        ror     al,1            ; *128
  58.        shr     al,1
  59.        add     al,dl           ; + col
  60.        mov     cx,1            ; write one of them
  61.        int     VIDI
  62.        inc     dl              ; increment row counter
  63.        mov     ah,2            ; cursor move function
  64.        int     VIDI
  65.        pop     cx              ; restore character counter
  66.        loop    achar
  67.        pop     cx              ; restore row counter
  68.        loop    row
  69. ;
  70. ;                      ; draw a line where it should start
  71.        mov     dx,5            ; row 5
  72.        mov     cx,0            ; col 0
  73. line:  push    cx
  74.        push    dx
  75.        mov     ax,0C01H        ; function 12=pixel
  76.        int     VIDI
  77.        pop     dx
  78.        pop     cx
  79.        inc     cx              ; step col
  80.        cmp     cx,700          ; ...until 700
  81.        jle     line
  82. ;
  83. ;                      ; wait for a keystroke
  84.        mov     ah,1
  85.        int     21H
  86. ;
  87.        mov     ax,7            ; back to alpha mode
  88.        int     VIDI
  89. ;
  90. ;                      ; Now return to system
  91.        xor     ax,ax           ; zero --> AX
  92.        int     21H             ; DOS function call 0 - terminate normally
  93. ;
  94. mode_prmt      db      "hercules or ibm mode? [ibm] $"
  95. mode_seq       db      7,0Fh,1,70h,0,9 ; sequence norm,hi,ul,rev,invis,norm
  96. START  endp
  97. cseg   ends
  98.